package com.hzhc.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hzhc.entity.RouterCollect;
import com.hzhc.enumBean.ResultUtilCodeEnum;
import com.hzhc.mapper.RouterCollectMapper;
import com.hzhc.service.RouterCollectService;
import com.hzhc.utils.ResultUtil;
import com.hzhc.vo.RouterCollectVo;
import lombok.RequiredArgsConstructor;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 路由常用列表 服务实现类
 * </p>
 *
 * @author huangp
 * @since 2024-07-06
 */
@Service
@RequiredArgsConstructor
public class RouterCollectServiceImpl extends ServiceImpl<RouterCollectMapper, RouterCollect> implements RouterCollectService {

    @Override
    public List<RouterCollect> getList(Page<RouterCollect> pagination, RouterCollectVo vo) {
        IPage<RouterCollect> iPage = baseMapper.getList(pagination, vo);
        return iPage.getRecords();
    }

    @Override
    public ResultUtil<Boolean> saveOrUpdateRet(List<RouterCollect> list) {
        boolean b = saveOrUpdateBatch(list);
        return ResultUtil.build(b, b? ResultUtilCodeEnum.SUCCESS: ResultUtilCodeEnum.FAIL);
    }

}
